package com.unicom.priceboard.util;

import java.util.Comparator;

/**
 * this class is used for sorting gainer,loser and Active list in descending order
 * Creation date: 2007-12-24
 * @author quan
 */
public class MyComparator implements Comparator<String> {

	public int compare(String o1, String o2) {
		int retVal = 0;
		double firstVal = Double.parseDouble(o1.split("-")[1]);
		double secondVal = Double.parseDouble(o2.split("-")[1]);
		
		if(secondVal>firstVal)
			retVal = 1;
		else if(secondVal<firstVal)
			retVal = -1;
		else
			retVal = 0;
			
		return retVal;
	}

}
